package com.itsu.app.controller;

import com.itsu.app.service.AppSoundService;
import com.itsu.pojo.vo.SoundVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("peachblossom")
public class SoundController {

    @Autowired
    AppSoundService appSoundService;

    @PostMapping
    public ResponseEntity publishSound(@RequestParam("soundFile") MultipartFile soundFile) {
        appSoundService.saveSound(soundFile);
        return ResponseEntity.ok(null);
    }

    @GetMapping
    public ResponseEntity getSound() {
        SoundVo soundVo = appSoundService.getSound();
        return ResponseEntity.ok(soundVo);
    }
}
